package com.lude.erp.prototype.model;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

import com.lude.erp.common.model.BaseModel;

@Entity(name = "identity_role")
public class IdentityRole implements BaseModel
{

	private static final long serialVersionUID = 1L;

	private long roleId;

	private IdentityRoleType identityRoleType;

	private Identity identity;

	private String description;

	private Date createdDate;

	private Date createdDatetime;

	private Date updatedDate;

	private Date updatedDatetime;

	private Set<IdentityRoleMenu> identityRoleMenus = new HashSet<IdentityRoleMenu>(0);

	private Set<IdentityRolePermission> identityRolePermissions = new HashSet<IdentityRolePermission>(0);

	@Id
	@GeneratedValue
	public long getRoleId()
	{
		return roleId;
	}

	public void setRoleId(long roleId)
	{
		this.roleId = roleId;
	}

	@ManyToOne
	@JoinColumn(name = "type_id")
	public IdentityRoleType getIdentityRoleType()
	{
		return identityRoleType;
	}

	public void setIdentityRoleType(IdentityRoleType identityRoleType)
	{
		this.identityRoleType = identityRoleType;
	}

	@ManyToOne
	@JoinColumn(name = "identity_id")
	public Identity getIdentity()
	{
		return identity;
	}

	public void setIdentity(Identity identity)
	{
		this.identity = identity;
	}

	public String getDescription()
	{
		return description;
	}

	public void setDescription(String description)
	{
		this.description = description;
	}

	public Date getCreatedDate()
	{
		return createdDate;
	}

	public void setCreatedDate(Date createdDate)
	{
		this.createdDate = createdDate;
	}

	public Date getCreatedDatetime()
	{
		return createdDatetime;
	}

	public void setCreatedDatetime(Date createdDatetime)
	{
		this.createdDatetime = createdDatetime;
	}

	public Date getUpdatedDate()
	{
		return updatedDate;
	}

	public void setUpdatedDate(Date updatedDate)
	{
		this.updatedDate = updatedDate;
	}

	public Date getUpdatedDatetime()
	{
		return updatedDatetime;
	}

	public void setUpdatedDatetime(Date updatedDatetime)
	{
		this.updatedDatetime = updatedDatetime;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "identityRole")
	public Set<IdentityRoleMenu> getIdentityRoleMenus()
	{
		return identityRoleMenus;
	}

	public void setIdentityRoleMenus(Set<IdentityRoleMenu> identityRoleMenus)
	{
		this.identityRoleMenus = identityRoleMenus;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "identityRole")
	public Set<IdentityRolePermission> getIdentityRolePermissions()
	{
		return identityRolePermissions;
	}

	public void setIdentityRolePermissions(Set<IdentityRolePermission> identityRolePermissions)
	{
		this.identityRolePermissions = identityRolePermissions;
	}

}
